#include "SobelCoreGenerator.h"

SobelCoreGenerator::SobelCoreGenerator () : LinearCoreGenerator (true, 3)
{

}

Core< float > SobelCoreGenerator::getCore (int size, int direction)
{
	float c[3][3] = { { -1, -2, -1 }, { 0, 0, 0 }, { 1, 2, 1 } };
	Core< float > core (QSize (3, 3));
	for (int i = 0; i < getSize (); ++i)
		for (int j = 0; j < getSize (); ++j) {
			int x = (direction == 0 ? j : i);
			int y = (direction == 0 ? i : j);
			core(x, y) = c[i][j];
		}
	return core;
}
